Skip to content

Conversation

@aklkv
Copy link

@aklkv aklkv commented Feb 8, 2026

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Summary

Migrates @sentry/ember from the legacy v1 addon format to the Ember v2 addon format. This modernizes the package to work with both classic Ember builds and Embroider-optimized builds, and removes the runtime dependency on @embroider/macros.

Changes

  • Build system: Replaced ember-cli build pipeline with rollup (transpilation → dist/) + tsc (declarations → declarations/)
  • Addon entry: Added addon-main.cjs using @embroider/addon-shim as the addon entry point
  • Package.json: Set ember-addon.version: 2, updated exports map, added ember-addon.app-js mapping
  • Config format: Replaced @embroider/macros getOwnConfig() with explicit Sentry.init() calls and a new setupPerformance() export

API changes:

  • init() is now called directly in app.ts or an initializer (no more ENV['@sentry/ember'] config)
  • setupPerformance() must be called from an instance-initializer to opt into performance instrumentation
  • Initial load instrumentation requires manual <script> tags in index.html
  • Added UPGRADE.md with detailed migration guide

Test & CI updates:

  • All 21 unit tests passing (acceptance tests for errors, performance, and replay)
  • Updated e2e test apps (ember-classic, ember-embroider) to use v2 patterns:
    • Added instance-initializers for performance setup
    • Migrated config from ENV['@sentry/ember'] to Sentry.init() in app.ts
    • Added initial load <script> tags to index.html
  • Updated .github/workflows/build.yml CACHED_BUILD_PATHS from packages/ember/*.d.ts to packages/ember/dist + packages/ember/declarations

TypeScript fixes:

  • Added "types": ["ember-source/types"] to tsconfig.publish.json for Ember module resolution during declaration generation
  • Fixed transition type imports (removed non-existent @ember/routing/-private/transition)
  • Simplified instrumentFunction generic to avoid tuple mismatch errors

Breaking Changes

  • ENV['@sentry/ember'] config in config/environment.js is no longer supported — use Sentry.init() directly
  • Performance instrumentation is no longer automatic — call setupPerformance() from an instance-initializer
  • Initial load tracking requires manual <script> tags in app/index.html

Closes #15835

@aklkv aklkv marked this pull request as ready for review February 8, 2026 09:40
@aklkv aklkv force-pushed the feat/ember-v2-format branch 3 times, most recently from 53dd617 to 822ed0a Compare February 8, 2026 11:01
Copy link
Member

@nicohrubec nicohrubec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for contributing. A few notes:

  1. This PR is way too large. Please split it up into smaller pieces so we can review it properly.
  2. Is there a way to get this done without introducing breaking changes? If no, then we need to wait with this until our next major.

@aklkv
Copy link
Author

aklkv commented Feb 9, 2026

Hey, thanks for contributing. A few notes:

  1. This PR is way too large. Please split it up into smaller pieces so we can review it properly.
  2. Is there a way to get this done without introducing breaking changes? If no, then we need to wait with this until our next major.

Hi @nicohrubec, thanks for the feedback!

I understand the concern about PR size. Unfortunately, the v1 → v2 addon migration is an atomic change — you can't incrementally migrate between formats. The build pipeline, entry point structure, and package.json layout must change together for the addon to function.

That said, the core SDK functionality is unchanged — the same instrumentation, error handling, and performance tracking code. The changes fall into two categories:

  1. Consumer-facing setup — how users configure the SDK (direct Sentry.init() calls instead of ENV['@sentry/ember'])
  2. Build/packaging scaffolding — the surrounding v2 addon infrastructure (Rollup config, addon-main.cjs, exports map, etc.)

The actual instrumentation logic in src/ is largely untouched. So while the diff is large, most of it is build tooling and test app updates to match the new setup pattern — not changes to Sentry functionality itself.

I'm happy to:

  • Add a review guide in the PR description highlighting which files contain meaningful changes vs. scaffolding
  • Split into multiple logical commits (build system, config API, test updates) to make review easier

Regarding breaking changes — the v2 format requires explicit Sentry.init() calls, so this would need to target the next major release.

Let me know how you'd like to proceed!

@aklkv aklkv force-pushed the feat/ember-v2-format branch from 822ed0a to 4874c99 Compare February 9, 2026 12:25
@johanrd
Copy link

johanrd commented Feb 9, 2026

@aklkv thanks a lot for doing this!🙏

FWIW: While waiting for this, I realized I didn't use the performance part of the addon, and was able to just use the @sentry/browser package without the need of any ember specific addon at all.

That also means that the 'breaking change' mentioned in the PR is a very welcome change to reduce the scope of what is delegated to the 'ember' part of the addon. Most is now just handled by the core apis, which it how it should be👍

(the link to Ember v2 addon format is broken in the pr description, btw)

Copy link

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good PR.

I understand the maintainer's perspective of wanting it split up tho.

The only way to do so would be rearranging the monorepo a bit to make a separate test app package.

This would mean the goal of that PR is to just delete the dummy app from the existing v1 addon.

That will still be a large pr, and i don't really see a way to get better than 2 large prs for this needed work.

Maintainers,
You mentioned breaking change timing - i suspect that is because all packages in this repo are released at once?

May i introduce you to https://github.com/release-plan/release-plan ?
It allows each package to be published independently with correct semver inference based on changes in git (and labels assessing impact on a pr) it helps a lot!

<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<script>if(window.performance&&window.performance.mark){window.performance.mark('@sentry/ember:initial-load-start');}</script>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these additions for? Are they needed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an app file, did the readme get updated to reflect the situation that wants this added?

Is it required?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good riddance

}
}

export default instrumentRoutePerformance(WithLoadingIndexRoute);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice way to do this!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! My questions were answered here in this doc! Tyty!

@aklkv aklkv force-pushed the feat/ember-v2-format branch from 4874c99 to 34b116c Compare February 9, 2026 22:18
@aklkv aklkv force-pushed the feat/ember-v2-format branch from 34b116c to 3f38914 Compare February 9, 2026 22:56
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

* };
* ```
*/
export async function setupPerformance(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary async masks errors as unhandled rejections

Medium Severity

setupPerformance is declared async but contains no await statements. The old instrumentForPerformance needed async because it had await import('@sentry/browser'), but the new code replaced that with static imports. Since all documentation and examples show calling setupPerformance without await (the instance-initializer returns void), any synchronous error thrown inside (e.g., from appInstance.lookup) becomes an unhandled promise rejection instead of propagating to Ember's boot error handling. This could silently swallow performance setup failures, making them very hard to debug.

Additional Locations (1)

Fix in Cursor Fix in Web

true,
'runloop spans not captured (expected in strict resolver test environment)',
);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runloop span test assertion unconditionally passes

Medium Severity

The runloop span assertion in assertSentryTransactions now unconditionally passes — if runloop spans exist, it asserts true (trivially true from the condition), and if they don't, it asserts assert.true(true, ...). This means regressions in runloop instrumentation can never be detected by the test suite. The old code had a real assertion that could fail. Per the review rules for feat PRs, tests need to actually test the newly added behavior.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert @sentry/ember addon to V2 addon format

4 participants